package junit;

import java.util.Date;
import java.util.List;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.sun.jmx.defaults.ServiceName;

import cn.pdx.elec.container.ServiceProvider;
import cn.pdx.elec.dao.ElecTextDao;
import cn.pdx.elec.domain.ElecText;
import cn.pdx.elec.service.ElecTextService;
import cn.pdx.elec.web.form.ElecTextForm;

public class TestService {
   
	/*@Test
	public void seveElecText(){
		
		ApplicationContext applicationContext=new ClassPathXmlApplicationContext("applicationContext.xml");
		
		//返回一个接口
		ElecTextService elecTextService=(ElecTextService) applicationContext.getBean(ElecTextService.SERVICE_NAME);
		
		//实例化对象，并保存
		ElecText elecText=new ElecText();
		
		elecText.setTextName("测试service");
		elecText.setTextDate(new Date());
		elecText.setTextRemark("测试service备注");
		elecTextService.saveElecText(elecText);
	}*/
	/*
	@Test
	public void seveElecText(){
		
		ElecTextService elecTextService=(ElecTextService)ServiceProvider.getService(ElecTextService.SERVICE_NAME);
		
		
		//实例化对象，并保存
		ElecText elecText=new ElecText();
		
		elecText.setTextName("测试service123");
		elecText.setTextDate(new Date());
		elecText.setTextRemark("测试service备注123");
		elecTextService.saveElecText(elecText);
	}*/
	
	/**
	 * 通过查询条件，查询对象列表集合
	 * 模仿action层
	 */
	@Test
	public void findCollection(){
		
		ElecTextService elecTextService=(ElecTextService)ServiceProvider.getService(ElecTextService.SERVICE_NAME);
		
		
		//实例化PO对象，并保存
		ElecTextService elecTextService1=(ElecTextService) ServiceProvider.getService(ElecTextService.SERVICE_NAME);
		ElecTextForm elecTextForm=new ElecTextForm();
		elecTextForm.setTextName("张");
		elecTextForm.setTextRemark("测");
		List<ElecText> list=elecTextService.findCollectionByConditionNoPage(elecTextForm);
	}
}
